//
//  xiuMiViewController.m
//  OfferJob
//
//  Created by 河南动力无限科技有限公司 on 17/7/21.
//  Copyright © 2017年 郑州动力无限科技. All rights reserved.
//

#import "xiuMiViewController.h"
#import "CellView.h"
@interface xiuMiViewController ()

@end

@implementation xiuMiViewController

- (void)viewDidLoad {
    self.title=@"修改密码";
    [super viewDidLoad];
    self.view .backgroundColor=backgroundcolor;
    float  setY=0;
    
    NSArray *vArrt=@[@"请输入原密码",@"请输入新密码",@"请再次输入新密码"];
//    NSArray *texArr=@[[NSString stringWithFormat:@"%@",[_dic objectForKey:@"user_phone"]] ,[_dic objectForKey:@"intent"]];
    for (int i=0; i<[vArrt count]; i++) {
        CellView *cell=[[CellView alloc]initWithFrame:CGRectMake(10*kAppScale, setY, self.view.width-20*kAppScale, 44*kAppScale)];
        cell.titleLabel.textColor=blackTextColor;
        cell.titleLabel.font=[UIFont  systemFontOfSize:13*kAppScale];
        cell.titleLabel.textAlignment=NSTextAlignmentLeft;
      
        UITextField *textF=[[UITextField alloc]initWithFrame:CGRectMake(10*kAppScale, 10*kAppScale, self.view.width-20*kAppScale, 44*kAppScale)];
        textF.font=[UIFont systemFontOfSize:13*kAppScale];
        textF.placeholder=vArrt[i];
//        textF.text=texArr[i];
        textF.tag=100+i;
        [cell addSubview:textF];
        [self.view addSubview:cell];
        setY=cell.bottom;
    }

    UIButton *nextBtn=[[UIButton alloc]initWithFrame:CGRectMake(10*kAppScale,setY+50*kAppScale,SCREEN_WIDTH-20*kAppScale,44*kAppScale)];
    nextBtn.backgroundColor=NavCOLOR;
    [nextBtn setTitle:@"保存" forState:UIControlStateNormal];
    [nextBtn setTitleColor:[UIColor whiteColor] forState:UIControlStateNormal];
    nextBtn.titleLabel.font=[UIFont systemFontOfSize:12*kAppScale];
    [nextBtn addTarget:self action:@selector(nextBtnEvent) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:nextBtn];

    
    
    
}
- (void)nextBtnEvent{

    UITextField *teField = (UITextField *)[self.view viewWithTag:100];
    NSString *rechangStr = teField.text ;
    
    UITextField *telField = (UITextField *)[self.view viewWithTag:101];
    NSString *telStr = telField.text ;
    
    UITextField *yixangField = (UITextField *)[self.view viewWithTag:102];
    NSString *yixiangStr = yixangField.text ;
    
    FXTHttpRequestModel * requestModel = [[FXTHttpRequestModel alloc] init];
    requestModel.type = FXTHttpType_POST;
    requestModel.appendUrl = @"/User/update_pwd";
    NSMutableDictionary * paramDic = [NSMutableDictionary dictionary];
    [paramDic setValue:tokenn forKey:@"token"];
    [paramDic setValue:rechangStr forKey:@"password"];
    [paramDic setValue:telStr forKey:@"new_pwd"];
    [paramDic setValue:yixiangStr forKey:@"renew_pwd"];
    requestModel.paramDic = paramDic;
    requestModel.callback = ^(FXTHttpResponseModel * result, NSError *error){
        if (result.state ==FXTReponseCodeState_Success) {
            NSLog(@"请求的结果是%@",result.data);
       
        }else {
            [DisplayHelper displayWarningAlert:result.alertMsg];
        }
    };
    [[FXTHttpSessionManager sharedHttpSessionManager] sendHttpRequestParam:requestModel];
    
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
